$(function(){
	/*点击发布按钮，提交数据到weibo_write.php进行后台处理*/
	$("#speach_submit").click(function(){
		/*获取发布框内容*/
		var content = $("#speach_content").val();
		var upload_file = $.cookie('upload_file');
		if(content != ""){
			$.ajax(
					{
						type: "POST",
						url: "php_ajax/weibo_write.php",
						dataType: "html",
						cache: false,
						data:  {speach:content},
						success: function() {
							dataLoad();
							recount();
						}
					}
			);
			$("#speach_content").val("");
		}
		else{
			
		}
		$.cookie('upload_file',null);
	});
	
	/*后台传数据到前台*/
	function dataLoad() {
		/*刷新微博*/
		$.ajax({
			type: "POST",
			url: "php_ajax/load_weibo.php",
			dataTpe: "html",
			cache: false,
			success: function(data){
				$("#weibo_box").empty().html(data);
			}
		});
		
		/*刷新微博数目*/
		$.ajax({
			type: "POST",
			url: "php_ajax/load_myWeibo_num.php",
			dataType: "html",
			cache: false,
			success: function(data){
				data = "微博" + data;
				$("#weiboNum_button a").empty().html(data);
			}
		});
	}
});